﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace Espam.Idiomas.Decimo.Tesis.Web
{
    public partial class UI_DashboardStudents : System.Web.UI.Page
    {
        

        string validaSession = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
                Response.Cache.SetAllowResponseInBrowserHistory(false);
                Response.Cache.SetNoStore();

                if (Session["userEspamIdiomasVarSession001"] == null || Session["rolEspamIdiomasVarSession003"] == null)
                {
                    validaSession = "NoHaIniciadoSession";
                    Response.Redirect("UI_Login.aspx?validaSession=" + validaSession);
                }
                else if (Session["userEspamIdiomasVarSession001"] != null && Session["rolEspamIdiomasVarSession003"].ToString() == "Docente")
                {
                    Response.Redirect("UI_DashboardTeacher.aspx");
                }
                else if (Session["userEspamIdiomasVarSession001"] != null && Session["rolEspamIdiomasVarSession003"].ToString() == "Administradores")
                {
                    Response.Redirect("Default.aspx");
                }
                else if (Session["userEspamIdiomasVarSession001"] != null && Session["rolEspamIdiomasVarSession003"].ToString() == "Alumno")
                {
                    DatosPanel();
                    ScriptManager.RegisterStartupScript(this.Page, GetType(), "AbrePopup", "click()",true);
                    
                }
            }
        }
        private void voz()
        {
           // SpVoice voice = new SpVoice();
            //voice.Speak("SESION INICIADA COMO " + Session["lastNameEspamIdiomasVarSession005"] + Session["nameEspamIdiomasVarSession006"]);
        }

        private void DatosPanel()
        {
            CultureInfo ci = new CultureInfo("es-Es");
            lblDateAndHour.Text = CapitalizeFirstLetter(ci.DateTimeFormat.GetDayName(DateTime.Today.DayOfWeek)) + " " + DateTime.Today.Day + " de " + CapitalizeFirstLetter(ci.DateTimeFormat.GetMonthName(DateTime.Now.Month)) + ", " + DateTime.Today.Year;
        }
        private string CapitalizeFirstLetter(string val)
        {
            return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(val);
        }

    }
}